var autoData = require('../autodata')
var Sequelize = require('sequelize');

var sequelize = new Sequelize('mysql://ushow:ushow@localhost/ushow', {})

// 创建 model
var Business = sequelize.define('demo', {
  uid: { type: Sequelize.STRING, primaryKey: true },
  area: Sequelize.STRING,
  lat: Sequelize.FLOAT,
  lon: Sequelize.FLOAT,
  count: Sequelize.INTEGER,
  aa: Sequelize.STRING,
  date: Sequelize.DATEONLY
}, { freezeTableName: true, timestamps: false });

// 创建表
// Business.sync() 会创建表并且返回一个 Promise 对象
// 如果 force = true 则会把存在的表（如果 business 表已存在）先销毁再创建表
// 默认情况下 forse = false
// Business.sync({ force: true })
// .then(() => Business.bulkCreate(autoData));

Business.bulkCreate(autoData)